package edu.gatech.app4args;

import edu.gatech.app4args.utils.DocxCreator;
import edu.gatech.app4args.utils.PptxCreator;
import edu.gatech.app4args.utils.XMLImporter;

import java.io.File;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

/**
 * The main class of the application.
 * @author David Kim
 */
public class App4Args extends SingleFrameApplication {

	/**
	 * At startup create and show the main frame of the application.
	 */
	@Override
	protected void startup() {
		show(new Main(this));
	}

	/**
	 * This method is to initialize the specified window by injecting resources.
	 * Windows shown in our application come fully initialized from the GUI
	 * builder, so this additional configuration is not needed.
	 */
	@Override
	protected void configureWindow(java.awt.Window root) {
	}

	/**
	 * A convenient static getter for the application instance.
	 * @return the instance of App4Args
	 */
	public static App4Args getApplication() {
		return Application.getInstance(App4Args.class);
	}

	/**
	 * Main method launching the application.
	 */
	public static void main(String[] args) {
		launch(App4Args.class, args);
		//testDocx();
		//testPptx();
		//testXMLImport();
	}

	// TODO move to Unit Tests

	/**
	 * Calls the DocxCreator's test method
	 */
	private static void testDocx() {
		// TODO add system print to confirm file created
		System.out.println("Creating docx..");
		DocxCreator docMaker = new DocxCreator();
		docMaker.testDocx();
	}
	/**
	 * Calls the PptxCreator's test method
	 */
	private static void testPptx() {
		// TODO add system print to confirm file created
		System.out.println("Creating pptx..");
		PptxCreator pptMaker = new PptxCreator();
		pptMaker.testPptx();
	}
	/**
	 * Creates a test map using the XML importer
	 */
	private static void testXMLImport() {
		XMLImporter xmlImport = new XMLImporter(true);
		xmlImport.createMap(new File("XMLFile.xml"));
	}
}
